package com.zhudi;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class FriendManager {
    private Map<String, Set<String>> friends;

    public FriendManager() {
        friends = new HashMap<>();
    }

    public void addFriend(String username, String friendName) {
        friends.putIfAbsent(username, new HashSet<>());
        friends.get(username).add(friendName);
    }

    public Set<String> getFriends(String username) {
        return friends.get(username);
    }

    public boolean removeFriend(String username, String friendName) {
        Set<String> friendList = friends.get(username);
        if (friendList != null) {
            return friendList.remove(friendName);
        }
        return false;
    }
}